package com.example.mobile2021606144ywr0407homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity7 extends AppCompatActivity {

    private TextView tvMainTitle6;
    private TextView textView2;
    private TextView textView3;
    private TextView textView4;
    private EditText editMain61;
    private Button btnMain6End;
    private TextView txt5;
    int num;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main7);
        initView();
        btnMain6End.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = editMain61.getText().toString();
                int num=Integer.valueOf(string).intValue();
                if (num >= 90){
                   txt5.setText("A");
                } if (80 <= num&num <= 89){
                    txt5.setText("B");
                } if (70 <= num&num <= 79){
                    txt5.setText("C");
                } if (60 <= num&num <= 69){
                    txt5.setText("D");
                }if (num<60){
                    txt5.setText("E");
                }
            }
        });
    }

    private void initView() {
        tvMainTitle6 = (TextView) findViewById(R.id.tv_main_title6);
        textView2 = (TextView) findViewById(R.id.tv_main6_1);
        textView3 = (TextView) findViewById(R.id.tv_main6_2);
        textView4 = (TextView) findViewById(R.id.tv_main6_3);
        editMain61 = (EditText) findViewById(R.id.edit_main6_1);
        btnMain6End = (Button) findViewById(R.id.btn_main6_end);
        txt5 = (TextView) findViewById(R.id.txt5);
    }
}